varying	vec3 vNormal;
varying	vec4 vPos;
varying	vec3 vPosM;

uniform mat4 MI;
uniform mat4 M;

#ifdef	SHADOW
uniform mat4 shadowMatrix;
varying vec4 vShadowCoord;
#endif

void main()
{
	gl_Position = vPos = gl_ModelViewProjectionMatrix * gl_Vertex;
	vec4 vPosMt = M * gl_Vertex;
	vPosM = vPosMt.xyz / vPosMt.w;
	//vNormal = (gl_ModelViewMatrixInverseTranspose * vec4(gl_Normal, 0.0)).xyz;
	vNormal = (MI * vec4(gl_Normal, 0.0)).xyz;
	vNormal = normalize(vNormal);
#ifdef	VCOLOR
	gl_FrontColor = gl_Color;
#endif
#ifdef	TEXTURED
	gl_TexCoord[0] = gl_MultiTexCoord0;
#endif
#ifdef	SHADOW
	vShadowCoord = shadowMatrix * gl_Vertex;
#endif
}